<template>
  <div class="container">
    <img src="@/assets/images/404.png" alt="" />
    <div>
      <div style="margin: 20px 0" id="text">抱歉!</div>
      <div
        style="margin: 20px 0; font-weight: 700; font-size: 3vh; color: #111"
      >
        当前页面不存在...
      </div>
      <div style="margin: 20px 0; color: #888; font-size: 1.5vh">
        请检查您输入的网址是否正确，或点击下面的按钮返回首页。
      </div>
      <div style="margin: 20px 0">
        <el-button type="primary" style="border-radius: 20px"
          >{{ this.time }}s后返回首页</el-button
        >
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'NotFound',
  components: {},
  data() {
    return {
      time: 5
    }
  },
  mounted() {
    this.countdown(5)
  },
  methods: {
    countdown(seconds) {
      if (seconds > 0) {
        console.log(seconds)
        this.time = seconds
        setTimeout(() => {
          this.countdown(seconds - 1)
        }, 1000)
      } else {
        this.$router.push('/home')
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 50%;
  margin: 0 auto;
}
#text {
  font-family: '楷体';
  font-weight: 700;
  font-size: 5vh;
  color: #409eff;
}
</style>
